package com.hanxing.kxcharge.module.operations.dal.mysql.equipment;

import java.util.*;

import com.hanxing.kxcharge.framework.common.pojo.PageResult;
import com.hanxing.kxcharge.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hanxing.kxcharge.framework.mybatis.core.mapper.BaseMapperX;
import com.hanxing.kxcharge.module.operations.dal.dataobject.equipment.EquipmentDO;
import org.apache.ibatis.annotations.Mapper;
import com.hanxing.kxcharge.module.operations.controller.admin.equipment.vo.*;

/**
 * 电桩管理 Mapper
 *
 * @author 航兴充电
 */
@Mapper
public interface EquipmentMapper extends BaseMapperX<EquipmentDO> {

    default PageResult<EquipmentDO> selectPage(EquipmentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EquipmentDO>()
                .eqIfPresent(EquipmentDO::getOrgId, reqVO.getOrgId())
                .eqIfPresent(EquipmentDO::getStationId, reqVO.getStationId())
                .eqIfPresent(EquipmentDO::getOperatorId, reqVO.getOperatorId())
                .betweenIfPresent(EquipmentDO::getOperatorTime, reqVO.getOperatorTime())
                .eqIfPresent(EquipmentDO::getEquipmentOwnerId, reqVO.getEquipmentOwnerId())
                .eqIfPresent(EquipmentDO::getEquipmentBrandId, reqVO.getEquipmentBrandId())
                .eqIfPresent(EquipmentDO::getEquipmentModelId, reqVO.getEquipmentModelId())
                .eqIfPresent(EquipmentDO::getVersion, reqVO.getVersion())
                .eqIfPresent(EquipmentDO::getEquipmentGunNumber, reqVO.getEquipmentGunNumber())
                .likeIfPresent(EquipmentDO::getEquipmentName, reqVO.getEquipmentName())
                .eqIfPresent(EquipmentDO::getEquipmentCode, reqVO.getEquipmentCode())
                .eqIfPresent(EquipmentDO::getCommunicationType, reqVO.getCommunicationType())
                .eqIfPresent(EquipmentDO::getCommunicationOperator, reqVO.getCommunicationOperator())
                .eqIfPresent(EquipmentDO::getIsSim, reqVO.getIsSim())
                .eqIfPresent(EquipmentDO::getNumberSim, reqVO.getNumberSim())
                .eqIfPresent(EquipmentDO::getParkNo, reqVO.getParkNo())
                .eqIfPresent(EquipmentDO::getParkLock, reqVO.getParkLock())
                .eqIfPresent(EquipmentDO::getPriceSet, reqVO.getPriceSet())
                .eqIfPresent(EquipmentDO::getFirmwareVersion, reqVO.getFirmwareVersion())
                .eqIfPresent(EquipmentDO::getIsEnableStart, reqVO.getIsEnableStart())
                .eqIfPresent(EquipmentDO::getIsOnline, reqVO.getIsOnline())
                .eqIfPresent(EquipmentDO::getEquipmentStandard, reqVO.getEquipmentStandard())
                .eqIfPresent(EquipmentDO::getChargingModuleBrandModel, reqVO.getChargingModuleBrandModel())
                .eqIfPresent(EquipmentDO::getChargingGunCableBrandModel, reqVO.getChargingGunCableBrandModel())
                .eqIfPresent(EquipmentDO::getEquipmentScreenBrand, reqVO.getEquipmentScreenBrand())
                .eqIfPresent(EquipmentDO::getEquipmentProcedure, reqVO.getEquipmentProcedure())
                .betweenIfPresent(EquipmentDO::getProductionDate, reqVO.getProductionDate())
                .eqIfPresent(EquipmentDO::getEquipmentModelType, reqVO.getEquipmentModelType())
                .betweenIfPresent(EquipmentDO::getSetPriceTime, reqVO.getSetPriceTime())
                .betweenIfPresent(EquipmentDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(EquipmentDO::getProtocolVersion, reqVO.getProtocolVersion())
                .eqIfPresent(EquipmentDO::getNetworkLinkType, reqVO.getNetworkLinkType())
                .eqIfPresent(EquipmentDO::getCostTemplateId, reqVO.getCostTemplateId())
                .orderByDesc(EquipmentDO::getId));
    }

}